<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>鼠标滑动图片放大</title>
    <style>
      .box {
        width: 360px;
        height: 360px;
        /* border: 2px solid red; */
        position: relative;
        overflow: hidden;
        cursor: pointer;
      }

      .box img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.5s;
      }

      .box::before {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: rgba(0, 0, 0, 0);
        transition: background-color 0.5s;
        z-index: 3;
      }

      .box:hover::before {
        background-color: rgba(0, 0, 0, 0.5);
      }

      .box:hover img {
        transform: scale(1.2);
      }

      .box span.play-button {
        display: block;
        width: 60px;
        height: 60px;
        /*background-color:khaki;*/
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0.5);
        z-index: 4;
        background-image: urL("./images/play.png");
        background-size: cover;
        opacity: 0;
        transition: opacity 0.5s, transform 0.5s;
      }

      .box:hover span.play-button {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
      }
    </style>
  </head>
  <body>
    <div class="box">
      <img src="./images/01.jpg" alt="" />
      <span class="play-button"></span>
    </div>
  </body>
</html>
